<#include
        "../../common/common.html"/> <@layout>
<link rel="stylesheet" type="text/css" href="${ctx}/static/cbb/artDialog/skins/blue.css">
<script src="${ctx}/static/cbb/artDialog/jquery.artDialog.js"></script>
<script src='${ctx}/static/assets/js/input_mask/bootstrap-inputmask.min.js' type='text/javascript'></script>

<script type="text/javascript">
    var url;
    /**
     * 新增
     */
    function newModel() {
        $('#dlg').dialog('setTitle', '新增').dialog('open');
        $('#myform').form('clear');
        url = '${ctx}/jsJjb/save';
        document.getElementById("lszljsxs").value  ='0.006126'   ;

    }
    /**
     * 修改
     */
    function editModel() {
        var row = $('#dt-grid').datagrid('getSelected');
        if (row) {
            var url = '${ctx}/jsJjb/newModes?id='+row.id;
            initArtDialog({url:url, title:'修改', width:650, height:450,lock:true,background: '#EAEAEA'});
//            $('#dlg').dialog('setTitle', '修改').dialog('open');
//            $('#myform').form('load', row);
            url = '${ctx}/jsJjb/update/' + row.id;
        } else {
            $.messager.show({
                title : '提示',
                msg : '请先选择一条信息，再进行修改！',
                timeout:2000
            });
        }
    }
    /**
     * 删除选中的模型信息
     */
    function deleteModel() {
        var row = $('#dt-grid').datagrid('getSelected');
        if (row) {
            $.messager.confirm('Confirm', '您确定要删除选中的记录吗?', function(r) {
                if (r) {
                    $.post('${ctx}/jsJjb/delete/' + row.id, function(data) {
                        $.messager.show({
                            title : '提示',
                            msg : data,
                            timeout:2000
                        });
                        $('#dt-grid').datagrid('reload'); // reload the user data
                    },"text");
                }
            });
        } else {
            $.messager.show({
                title : '提示',
                msg : '请先选择一条记录，再进行删除！',
                timeout:2000
            });
        }
    }
    /**
     * 保存新增的模型数据
     */
    function saveModel() {
        $('#myform').form('submit', {
            url : url,
            onSubmit : function() {
                return $(this).form('validate');
            },
            success : function(data) {
                $('#dlg').dialog('close');
                $('#dt-grid').datagrid('reload');
                $.messager.show({ // show error message
                    title : '提示',
                    msg : data,
                    timeout:2000
                });
            }
        });
    }
    /**
     * 根据查询条件进行查询，各条件需要加上query样式，以便函数自动提取查询参数
     */
    function queryModel() {
        $('#dt-grid').datagrid('load',$.getQueryParam('queryTable'));
    }
    /**
     * 取消grid组件的选中状态
     */
    function unCheckModel() {
        $('#dt-grid').datagrid('uncheckAll');
    }

    //新增
    function newModels(){
        var url = '${ctx}/jsJjb/newModes';
        initArtDialog({url:url, title:'新增', width:650, height:450,lock:true,background: '#EAEAEA'});
    }

    function yxbz(value,rec){
        if(rec.yxbz=="1"){
            return '是';
        }   else{
            return '否';
        }
    }
</script>
<body class="easyui-layout">
<div data-options="region:'north'" style="height: 40px; padding: 2px">
    <table id='queryTable' cellpadding="0" cellspacing="0"
           class="form-table" align='center'>
        <tr>
            <td style="width: 100px">拉丝规格</td>
            <td style="width: 480px"><input name="search_EQ_lsgg" id="search_EQ_lsgg"
                                            class="query" style="width: 150px"   data-mask='9.99' placeholder='0.00'/>
            </td>
            <td><a href="#" class="easyui-linkbutton"
                   data-options="iconCls:'icon-search'" onclick="queryModel()">查询</a>
            </td>
        </tr>


    </table>
</div>
<div region="center" border="false">
    <table id="dt-grid" class="easyui-datagrid"
           data-options="url:'${ctx}/jsJjb/query',fit:true,fitColumns:true,idField:'id',border:false,pagination:true,rownumbers:true,singleSelect:true,toolbar:'#toolbar'">
        <thead>
        <tr>
            <th field="cpmc" width="100">产品规格</th>
            <th field="jjb" width="100">节径比</th>
            <th field="nsxs" width="100">捻缩系数</th>
            <th field="yxbz" formatter="yxbz" width="100">有效标志</th>

        </tr>
        </thead>
    </table>
    <div id="toolbar">
        <a href="#" class="easyui-linkbutton"
           data-options="iconCls:'icon-add',plain:'true'" onclick="newModels()">新增</a>
        <a href="#" class="easyui-linkbutton"
           data-options="iconCls:'icon-edit',plain:'true'"
           onclick="editModel()">修改</a> <a href="#" class="easyui-linkbutton"
                                           data-options="iconCls:'icon-remove',plain:'true'"
                                           onclick="deleteModel()">删除</a> <a href="#"
                                                                             class="easyui-linkbutton"
                                                                             data-options="iconCls:'icon-undo',plain:'true'"
                                                                             onclick="unCheckModel()">取消</a>
    </div>
</div>



</body>

</@layout>

